// const Promise = require('./MyPromise')
// let p1 = Promise.resolve('P1')
// let p2 = Promise.resolve('P2')
// const p3 = Promise.resolve(new Promise((resovle, reject) => {
//     reject('error')
// }))

// Promise.race([p1,p2]).then(v=>{
//     console.log(v)
// })
// Promise.race([p1,p2,p3]).then(v=>{
//     console.log(v)
// },r=>{
//     console.log(r)
// })

const Promise = require('./MyPromise')
console.log('start')
const p1 = new Promise((resolve,reject)=>{
    // resolve('OK')
    reject('error')
    console.log('promise')
})
p1.then(v=>{
    console.log('then',v)
}, r=>{
    console.log(r)
})
console.log('end')